package com.tbit.main.controller;


import com.tbit.main.common.JsonResult;
import com.tbit.main.pojo.MachineAbnormal;
import com.tbit.main.service.MachineAbnormalService;
import com.tbit.main.util.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 故障异常
 *
 * @author Leon
 * 2019年11月16日 下午3:11:00
 */
@RestController
@RequestMapping("/machineAbnormal")
public class MachineAbnormalController {
    @Autowired
    private MachineAbnormalService machineAbnormalService;

    /**
     * 根据设备编号查询
     */
    @RequestMapping("/getByMachineId")
    public JsonResult groupByTime(String token, Integer machineId) {
        Assert.notNull(machineId, "Machine.machineId.notNull");

        List<MachineAbnormal> machineAbnormals = machineAbnormalService.getByMachineId(machineId);

        return JsonResult.succ(machineAbnormals);
    }

}